<%--
  Created by IntelliJ IDEA.
  User: 20275
  Date: 2023/11/16
  Time: 16:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<html>
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>宿舍楼人员管理系统</title>
    <link href="${pageContext.request.contextPath }/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/sb-admin-2.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<style>
    img {
        width: 170px; /* 设置图像的宽度为300像素 */
        height: auto; /* 高度自动调整以保持纵横比 */
        border: 3px solid #ccc;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    }
    /* 样式表 */
    .avatar-wrapper {
        position: relative;
        display: inline-block;
        margin-right: 20px;
    }
    .avatar {
        width: 200px;
        height: 200px;
        border-radius: 50%;
        object-fit: cover;
        margin-bottom: 20px;
        background-color: beige;
    }
    .upload-btn {
        position: absolute;
        bottom: 0;
        right: 0;
        padding: 10px 20px;
        background-color: #4CAF50;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        z-index: 1;
    }
    .upload-btn:hover {
        background-color: #3e8e41;
    }
    .hidden {
        display: none;
    }
</style>
    <script src="${pageContext.request.contextPath}/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="${pageContext.request.contextPath }/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="${pageContext.request.contextPath }/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="${pageContext.request.contextPath }/dist/js/sb-admin-2.js"></script>
</head>
<body>

<script>
    $(document).ready(function() {
        // 点击 - 退出按钮
        $("#exit_span").click(function(){
            console.log("退出当前用户");
            $.ajax({
                type: 'get',
                url: '${pageContext.request.contextPath }/exit',
                success: function(response) {
                    alert("退出成功！")
                    location.href = "${pageContext.request.contextPath}/login.jsp"
                },
                error: function(log) {
                    // 在请求出错时的处理
                    console.log('选择记录请求出错:'+log);
                }
            });
        });
    });
</script>

    <div id="wrapper">

        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">SSM - 宿舍楼人员管理系统</a>
            </div>
            <!-- 图标集 -->
            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="#"><i class="fa fa-user fa-fw"></i> 用户</a>
                        </li>
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> 设置</a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a id="exit_span">
                                <i class="fa fa-sign-out fa-fw"></i> 退出用户
                            </a>
                        </li>
                    </ul>
                </li>

            </ul>
            <!-- 侧边导航栏 -->
            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
                    <ul class="nav" id="side-menu">
                        <li class="sidebar-search">
                            <div class="input-group custom-search-form">
                                <input type="text" class="form-control" placeholder="暂未开发...">
                                <span class="input-group-btn">
                                    <button class="btn btn-default"  type="button">查找</button>
                                </span>
                            </div>
                        </li>
                        <c:forEach varStatus="i" items="${menupowerinfo}" var="Info">
                            <%--    存在下级菜单    --%>
                            <c:if test="${fn:length(Info.list) != 0}">
                                <li>
                                    <a href="#"><i class="fa ${Info.info.menuPowerIcon} fa-fw"></i> ${Info.info.menuPowerName}<span
                                            class="fa arrow"></span></a>
                                    <ul class="nav nav-second-level">
                                        <c:forEach varStatus="i" items="${Info.list}" var="Info_list">
                                            <li>
                                                <a href="${pageContext.request.contextPath}/${Info_list.menuPowerHref}">${Info_list.menuPowerName}</a>
                                            </li>
                                        </c:forEach>
                                    </ul>

                                </li>
                            </c:if>
                            <%--    不存在下级菜单    --%>
                            <c:if test="${fn:length(Info.list) == 0}">
                                <li>
                                    <a href="${pageContext.request.contextPath}/${Info.info.menuPowerHref}"><i class="fa ${Info.info.menuPowerIcon} fa-fw"></i> ${Info.info.menuPowerName}</a>
                                </li>
                            </c:if>
                        </c:forEach>
                    </ul>
                </div>
            </div>
        </nav>

